<?php

include("PHPMailer/class.phpmailer.php");
include("PHPMailer/class.smtp.php");

class SmtpMail {

    private $Host;
    private $Username;
    private $Password;
    private $From;

    public function __construct($mensaje, $asunto, $destinatarios, $host, $username, $password, $cabeceras = "", $from="") {
        parent::__construct($mensaje, $asunto, $destinatarios, $cabeceras);

        $this->Host = $host;
        $this->Username = $username;
        $this->Password = $password;
        $this->From = $from;
    }

    public function SendMail() {

        $mail = new PHPMailer();
        $mail->IsSMTP();
        $mail->SMTPAuth = true;
        $mail->SMTPSecure = "ssl";
        $mail->Host = $this->Host;
        $mail->Port = 465;
        $mail->FromName = $this->From;
        $mail->Username = $this->Username;
        $mail->Password = $this->Password;
        $mail->MsgHTML($this->Mensaje);
        $mail->Subject = $this->Asunto;

        foreach ($this->Destinatarios as $Email) {
            $mail->AddAddress($Email);
        }

        $mail->IsHTML(true);

        return $mail->Send();
    }

}

?>
